home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 5.8 KB | 211 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: ClockSel.cpp
- // Release Version: $ 1.0d1 $
- //
- // Author: Lonnie Millett
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef CLOCKSEL_H
- #include "ClockSel.h"
- #endif
-
- #ifndef CLOCKPAR_H
- #include "ClockPar.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWMEMMGR_H
- #include <FWMemMgr.h>
- #endif
-
- #ifndef FWPART_H
- #include "FWPart.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _SHAPE_
- #include <Shape.h>
- #endif
-
- #ifndef _DRAGDROP_
- #include <DragDrop.h>
- #endif
-
- #ifndef _XMPSESSN_
- #include <XMPSessM.h>
- #endif
-
- #ifndef _STDPROPS_
- #include <StdProps.h>
- #endif
-
- #ifndef _STDTYPES_
- #include <StdTypes.h>
- #endif
-
- #ifndef _TRNSFORM_
- #include <Trnsform.h>
- #endif
-
- #ifndef _STORAGEU_
- #include <StorageU.h>
- #endif
-
- #ifndef _EXCEPT_
- #include <Except.h>
- #endif
-
- #ifndef _TRANSLAT_
- #include <Translat.h>
- #endif
-
- // ----- Macintosh Includes -----
-
- #if defined(FW_BUILD_MAC) && !defined(__DRAG__)
- #include <Drag.h>
- #endif
-
- #pragma segment ClockPart
-
- //==============================================================================
- // •• class CClockSelection
- //==============================================================================
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::CClockSelection
- //---------------------------------------------------------------------------------------
-
- CClockSelection::CClockSelection()
- {
- fClockPart = NULL;
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::InitClockSelection
- //---------------------------------------------------------------------------------------
-
- void CClockSelection::InitClockSelection(CClockPart* clockPart)
- {
- InitSelection(clockPart, FALSE, FALSE);
-
- fClockPart = clockPart;
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::~CClockSelection
- //---------------------------------------------------------------------------------------
-
- CClockSelection::~CClockSelection()
- {
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::CloseSelection
- //---------------------------------------------------------------------------------------
-
- void CClockSelection::CloseSelection()
- {
- // Nothing to do here
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::DoClear
- //---------------------------------------------------------------------------------------
-
- FW_Boolean CClockSelection::DoClear()
- {
- // Nothing to do here
- return FALSE;
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::SelectAll
- //---------------------------------------------------------------------------------------
-
- void CClockSelection::SelectAll()
- {
- // Nothing to do here
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::IsEmpty
- //---------------------------------------------------------------------------------------
-
- FW_Boolean CClockSelection::IsEmpty() const
- {
- return TRUE;
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::ExternalizeSelection
- //---------------------------------------------------------------------------------------
-
- void CClockSelection::ExternalizeSelection(XMPStorageUnit* storageUnit, FW_CFrame* commandFrame, XMPCloneKind cloneKind)
- {
- FW_UNUSED(storageUnit);
- FW_UNUSED(commandFrame);
- FW_UNUSED(cloneKind);
- }
-
- //---------------------------------------------------------------------------------------
- // • CClockSelection::InternalizeSelection
- //---------------------------------------------------------------------------------------
-
- FW_Boolean CClockSelection::InternalizeSelection(XMPStorageUnit* storageUnit, XMPCloneKind cloneKind)
- {
- FW_UNUSED(cloneKind);
-
- FW_Boolean internalized = FALSE;
-
- XMPTranslation *translate = GetPart()->GetSession()->GetTranslation();
- XMPType PICTType = translate->GetISOTypeFromPlatformType('PICT', kXMPPlatformDataType);
- XMPType sndType = translate->GetISOTypeFromPlatformType('snd ', kXMPPlatformDataType);
-
- if (storageUnit->Exists(kXMPPropContents, PICTType, 0))
- {
- storageUnit->Focus(kXMPPropContents, kXMPPosUndefined, PICTType, (XMPValueIndex)0, kXMPPosUndefined);
-
- unsigned long pictSize = storageUnit->GetSize();
- PicHandle pictHandle = (PicHandle)FW_CMemoryManager::AllocateSystemHandle(pictSize);
- THROW_IF_NULL(pictHandle);
-
- FW_CMemoryManager::LockSystemHandle((FW_PlatformHandle)pictHandle);
- storageUnit->GetValue(pictSize, (XMPValue)*pictHandle);
- FW_CMemoryManager::UnlockSystemHandle((FW_PlatformHandle)pictHandle);
-
- fClockPart->SetBackgroundPICT(pictHandle);
-
- fClockPart->InvalidateAllFrames(fClockPart->GetDefaultPresentation(), NULL, NULL);
-
- internalized = TRUE;
- }
- // We should use kXMPApplesnd here but it is currently defined wrong
- // Just type cast the string for right now
- else if (storageUnit->Exists(kXMPPropContents, (XMPValueType)sndType, 0))
- {
- storageUnit->Focus(kXMPPropContents, kXMPPosUndefined, (XMPValueType)sndType, (XMPValueIndex)0, kXMPPosUndefined);
-
- unsigned long sndSize = storageUnit->GetSize();
- FW_PlatformHandle sndHandle = FW_CMemoryManager::AllocateSystemHandle(sndSize);
- THROW_IF_NULL(sndHandle);
-
- FW_CMemoryManager::LockSystemHandle(sndHandle);
- storageUnit->GetValue(sndSize, (XMPValue)*sndHandle);
- FW_CMemoryManager::UnlockSystemHandle(sndHandle);
-
- fClockPart->SetChimeSound(sndHandle);
-
- internalized = TRUE;
- }
-
- return internalized;
- }
-
-